import http from "@/http/http";
import { AddMenuModel } from "./menuModel";

enum Api {
    getMenuList = '/api/sysUser/getMenuList',
    getTable = '/api/menu/list',
    add = '/api/menu',
    edit = '/api/menu',
    delete = '/api/menu',
    getParent = '/api/menu/parent'
}

// 获取菜单信息
export const getMenuListApi = async () => {
    return await http.get(Api.getMenuList)
}

// 获取菜单列表
export const getMenuApi = async () => {
    return await http.get(Api.getTable)
}

// 增加菜单
export const addMenuApi = async (params:AddMenuModel) => {
    return await http.post(Api.add,params)
}

// 编辑菜单
export const editMenuApi = async (params:AddMenuModel) => {
    return await http.put(Api.edit, params)
}

// 删除菜单
export const deleteMenuApi = async (id) => {
    return await http.delete(Api.delete, id)
}

// 获取上级菜单
export const getParentApi = async () => {
    return await http.get(Api.getParent)
}